package com.dc.kylin.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutConfig {

    //声明队列
    @Bean
    public Queue fanoutQ1(){
        return new Queue("fanout.Q1");
    }

    @Bean
    public Queue fanoutQ2(){
        return new Queue("fanout.Q2");
    }

    //声明交换机
    @Bean
    public FanoutExchange setFanoutExchange(){
        return new FanoutExchange("fanoutExchange");
    }

    //声明绑定关系
    @Bean
    public  Binding fanoutQ1Binding(){
        return BindingBuilder.bind(fanoutQ1()).to(setFanoutExchange());
    }

    @Bean
    public  Binding fanoutQ2Binding(){
        return BindingBuilder.bind(fanoutQ2()).to(setFanoutExchange());
    }








}
